/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package cep.db;

import cep.classes.Cep;
import conexao.ConexaoSingleton;
import conexao.DAOException;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.Query;

/**
 *
 * @author Wolverine
 */
public class cepDAO implements ICepDao{
    
    EntityManager manager;

    public cepDAO() throws DAOException {
        try {
            this.manager = ConexaoSingleton.getConexao();
        } catch (Exception ex) {
            throw new DAOException("Erro conexão com Banco de Dados", ex);
        }
    }

    public List<Cep> consultarCep(String cep){
        Query p = manager.createQuery("select p from cep p where (cep='" + cep + "')");
        List<Cep> c = p.getResultList();
        return c;
    }



    public List<Cep> consultarLogradouro(String logradouro) {
        throw new UnsupportedOperationException("Not supported yet.");
    }
 }
